{% extends "base.html" %}

{% block title %}Account Settings{% endblock %}

{% block navdropdown %}
<div class="navbar-collapse navbar-responsive-collapse collapse" style="height: 1px;">
	<ul class="nav navbar-nav navbar-right">
		<li class="dropdown">
			<a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ lang.header_account }}<b class="caret"></b></a>
				<ul class="dropdown-menu">
					<li><a href="{{ settings.master_url }}logout.php">{{ lang.header_logout }}</a></li>
					{% if admin %}<li><a href="{{ settings.master_url }}admin/index.php">{{ lang.header_admin }}</a></li>{% endif %}
				</ul>
		</li>
	</ul>
</div>
{% endblock %}

{% block sidebar %}
<div class="list-group">
	<a href="#" class="list-group-item list-group-item-heading"><strong>{{ lang.sidebar_acc_actions }}</strong></a>
	<a href="account.php" class="list-group-item active">{{ lang.sidebar_settings }}</a>
	<a href="totp.php" class="list-group-item">TOTP {{ lang.sidebar_settings }}</a>
	<a href="servers.php" class="list-group-item">{{ lang.sidebar_servers }}</a>
</div>
{% endblock %}

{% block content %}
<div class="col-9">
	{{ output|raw }}
	<div class="row">
		<div class="col-6">
			<h3 class="nopad">{{ lang.settings_change_pass }}</h3><hr />
				<form action="account.php?action=password" method="post">
					<div class="form-group">
						<label for="p_password" class="control-label">{{ lang.settings_current_pass }}</label>
						<div>
							<input type="password" class="form-control" name="p_password" />
						</div>
					</div>
					<div class="form-group">
						<label for="p_password_new" class="control-label">{{ lang.settings_new_pass }}</label>
						<div>
							<input type="password" class="form-control" name="p_password_new" />
						</div>
					</div>
					<div class="form-group">
						<label for="p_password_new_2" class="control-label">{{ lang.settings_new_pass }} {{ lang.string_again }}</label>
						<div>
							<input type="password" class="form-control" name="p_password_new_2" />
						</div>
					</div>
					<div class="form-group">
						<div>
							{{ xsrf.pass|raw }}
							<input type="submit" class="btn btn-primary" value="{{ lang.settings_change_pass }}" />
						</div>
					</div>
				</form>
		</div>
		<div class="col-6">
			<h3 class="nopad">{{ lang.settings_update_email }}</h3><hr />
				<form action="account.php?action=email" method="post">
					<div class="form-group">
						<label for="email" class="control-label">{{ lang.settings_new_email }}</label>
						<div>
							<input type="text" class="form-control" name="newemail" />
						</div>
					</div>
					<div class="form-group">
						<label for="password" class="control-label">{{ lang.settings_current_pass }}</label>
						<div>
							<input type="password" class="form-control" name="password" />
						</div>
					</div>
					<div class="form-group">
						<div>
							{{ xsrf.email|raw }}
							<input type="submit" class="btn btn-primary" value="{{ lang.settings_update_email }}" />
						</div>
					</div>
				</form>
		</div>
	</div>
	<div class="row">
		<div class="col-6">
			<h3>Login Notification</h3><hr />
			<form action="account.php?action=notifications" method="post">
				<div class="row">
					<div class="col-6 nopad">
						<div class="form-group">
							<h4>Success</h4>
							{% for key, notify in success_login %}
							<div class="radio">
							    <label for="{{ key }}" class="alt-label"><input type="radio" id="{{ key }}" name="e_s" value="{{ notify.value }}" {{ notify.checked }} />{% if notify.value == 1 %}{{ lang.settings_notify_email_me }}{% else %}{{ lang.settings_notify_no_email_me }}{% endif %}</label>
							</div>
							{% endfor %}
						</div>
					</div>
					<div class="col-6">
						<div class="form-group">
							<h4>Failed</h4>
							{% for key, notify in failed_login %}
							<div class="radio">
						        <label for="{{ key }}" class="alt-label"><input type="radio" id="{{ key }}" name="e_f" value="{{ notify.value }}" {{ notify.checked }} />{% if notify.value == 1 %}{{ lang.settings_notify_email_me }}{% else %}{{ lang.settings_notify_no_email_me }}{% endif %}</label>
							</div>
							{% endfor %}
						</div>
					</div>
				</div>
				<div class="form-group">
					<label for="password" class="control-label">{{ lang.settings_current_pass }}</label>
					<div>
						<input type="password" class="form-control" name="password" />
					</div>
				</div>
				<div class="form-group">
					<div>
						{{ xsrf.notify|raw }}
						<input type="submit" class="btn btn-primary" value="{{ lang.settings_update_preferences }}" />
					</div>
				</div>
			</form>
		</div>
		<div class="col-6">
			<h3>Sub-User Token</h3><hr />
			<div class="well well-sm"><p>If you have recieved an email because you were added as a subuser on a server please enter that token in the box below.</p></div>
			<form action="account.php?action=subuser" method="post">
				<div class="form-group">
					<label for="token" class="control-label">Token</label>
					<div>
						<input type="text" class="form-control" name="token" />
					</div>
				</div>
				<div class="form-group">
					<div>
						{{ xsrf.notify|raw }}
						<input type="submit" class="btn btn-primary" value="Validate Token" />
					</div>
				</div>
			</form>
		</div>
	</div>
</div>
{% endblock %}
